var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var ngAnnotate = require('gulp-ng-annotate');
var minifyCSS = require('gulp-minify-css');

var paths = {
  scripts: ['www/js/**/*.js', '!www/js/lib/*'],
  css: ['www/js/**/*.css', '!www/js/lib/*']
};

gulp.task('css', function () {
  gulp.src(paths.css)
    .pipe(minifyCSS())
    .pipe(concat('app.min.css'))
    .pipe(gulp.dest('www/js/dist'))
});

gulp.task('js', function () {
  gulp.src(paths.scripts)
    .pipe(ngAnnotate())
    .pipe(uglify())
    .pipe(concat('app.min.js'))
    .pipe(gulp.dest('www/js/dist/'));
});

//gulp.task('auto', function () {
//  gulp.watch([paths.scripts[0],'!www/js/dist/*'],['js']);
//  gulp.watch([paths.css[0],'!www/js/dist/*'], ['css']);
//});

gulp.task('default',['css','js']);
